package awt;

import java.awt.*;

/**
 * @description: 容器的嵌套
 * @author: Tom
 * @create: 2019-07-23 17:05
 **/
public class TestNesting {
    private Frame f;
    private  Panel p;
    private Button bw,bc;
    private Button bfile ,bhelp;
    private  TextArea ta;
    public void create(){
        f= new Frame("容器嵌套");
        ta = new TextArea("test Area");
        bw = new Button("West");
        bc = new Button("Work space region");
        f.add(bw, "West");
        f.add(bc, "Center");
        p = new Panel();
        p.setLayout(new BorderLayout());
        f.add(p, "North");
        bfile = new Button("文件");
        bhelp = new Button("帮助");
        p.add(bfile, "North");
        p.add(bhelp, "West");
        p.add(ta, "Center");
        f.pack();
        f.setVisible(true);

    }

    public static void main(String[] args) {
        TestNesting testNesting =new TestNesting();
        testNesting.create();
    }
}
